package dan.android.guardianlocation;

import android.app.Activity;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import dan.android.guardianlocation.gps.Tracker;

public class MainActivity extends Activity {

	private Tracker gps;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		gps = new Tracker(this);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	public void getLocation(View v) {
		System.out.println("Boton");
		Location point = gps.getCurrentLocation(10, 5);
		Log.d("Latitude", point.getLatitude() + "");
		Log.d("Longitud", point.getLongitude() + "");
		TextView lat = (TextView) findViewById(R.id.Lat);
		TextView lon = (TextView) findViewById(R.id.Lon);
		lat.setText(point.getLatitude() + "");
		lon.setText(point.getLongitude() + "");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
